<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: blog.php 20 2013-09-21 11:53:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 20 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:53:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('includes/application_top.php');

if(MODULE_SEO_URL_INDEX_STATUS == 'True') {
   	require_once(DIR_FS_INC.'inc.seo_url.php');
 	!$seo_url ? $seo_url = new SeoUrl() : false;
}

require_once(DIR_WS_CLASSES.'class.blog.php');
$blog = new Blog();

switch($_GET['action']) {
	case 'save_category' :
		$blog->blogCategories($_POST, $_POST['action']);
		redirect(href_link(FILENAME_BLOG));
		break;

	case 'save_item' :
		$blog->blogItem($_POST, $_POST['action']);
		redirect(href_link(FILENAME_BLOG, 'action=showitems&cat='.$_POST['categories_id']));
		break;
		
	case 'set':
		$blog->SetStatus($_POST);
		if((int)$_GET['cat'])
			redirect(href_link(FILENAME_BLOG, 'action=showitems&cat='.(int)$_GET['cat']));
		else
			redirect(href_link(FILENAME_BLOG));
		break;
}

require(DIR_FS_ADMIN.DIR_WS_INCLUDES.'xajax/xajax.blog.php');
require(DIR_WS_INCLUDES.'metatag.php');
if(!empty($xajax))
	$xajax->printJavascript();
?>
<script type="text/javascript">
	function checkboxes(wert){
		var my = document.leiste;
		var len = my.length;
	
		for (var i = 0; i < len; i++) {
			var e = my.elements[i];
			if (e.name == "status[]") {
				e.checked = wert;
			}
		}
	}
	function showOverlay(e) {
		var width = $(e).outerWidth();
		var height = $(e).outerHeight();
		var offset = $(e).offset();
		$(e).css({'position':'relative', 'overflow':'hidden'});
	
		if($(e).children("#ajax_overlay").length < 1) {
			$('body').append('<div id="ajax_overlay"><img class="ajax_spinner" src="../images/ajax_spinner.gif" alt="Lade Daten" /></div>');
		}
		$('#ajax_overlay').css({'width': width+'px', 'height': height+'px', 'top':offset.top+'px', 'left':offset.left+'px'}).fadeIn();
	
		return false;
	}
	$(function(){$('.boxCenter').fadeIn()});
</script>
</head>
<body>
<?php require(DIR_WS_INCLUDES.'header.php'); ?>
<div id="wrapper">
<table class="outerTable" cellpadding="0" cellspacing="0">
  <tr>
    <td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
      <?php require(DIR_WS_INCLUDES.'column_left.php'); ?>
    </td>
    <td class="boxCenter dn" valign="top">
       <table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
	    <tr>
	     <td class="pageHeading">
	        <?php echo HEADING_TITLE; ?>
	     </td>
	   </tr>
	   </table>
		<table border="0" cellspacing="5" cellpadding="5" width="100%">
		  <tr>
		  	<td align="right">
			    <a class="button" href="<?php echo href_link(FILENAME_BLOG);?>"><?php echo TABLE_HEADING_NAVIGATION_OVERVIEW; ?></a>
			    <a class="button" href="<?php echo href_link(FILENAME_BLOG,'action=newcategorie');?>"><?php echo TABLE_HEADING_NAVIGATION_NEWCATEGORIE; ?>
			 </td>
		  </tr>
		</table>
		<?php
			switch ($_GET['action']) {
				case 'newcategorie' :
				case 'editcategories' :
					include(DIR_WS_MODULES.'blog_categories_edit.php');
					break;
	
				case 'edit_item' :
				case 'new_item' :
					include(DIR_WS_MODULES.'blog_item_edit.php');
					break;
	
				case 'showitems' :
					include(DIR_WS_MODULES.'blog_item_list.php');
					break;
	
				default :
					include(DIR_WS_MODULES.'blog_categories_list.php');
					break;
			}
		?>
        </td>
      </tr>
	</table>
</div>
<?php require(DIR_WS_INCLUDES.'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES.'application_bottom.php'); ?>